package com.autel.webrtc.demo.common.storage;

import lombok.extern.slf4j.Slf4j;

/**
 * @author huawenyao
 */
@Slf4j
public class ThreadLocalHolder {

    private static ThreadLocalHolder threadLocalHolder = new ThreadLocalHolder();

    private ThreadLocal<String> userProductId = new ThreadLocal<String>();


    public String getUserProductId(String id) {
        return userProductId.get();

    }

    public static ThreadLocalHolder getInstance() {
        return threadLocalHolder;
    }

    /**
     * 全部清空线程变量
     */
    public void clearAll() {
        userProductId.remove();
    }
}